package com.woniuxy.thred.state;

/**
 * description: YieldDemo02 <br>
 * date: 2022/2/5 6:17 下午 <br>
 * author: shesaifei <br>
 * version: 1.0 <br>
 */
public class YieldDemo02 {
    public static void main(String[] args) {
        new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("lambda!" + i);
            }
        }).start();
        for (int i = 0; i < 100; i++) {
            if (i % 20 == 0) {
                Thread.yield();//main礼让
            }
            System.out.println("main....." + i);
        }
    }
}

